#ifndef __LOG_H_09320__
#define __LOG_H_09320__

#include "BaseInc.h"
#include "Singleton.h"
#include <string>
#include <hash_map>
#include <time.h>

LUJ_NAMESPACE_BEGIN

class ILog;

class CLogMgr : public CSingleton<CLogMgr>
{
	friend CSingleton<CLogMgr>;
public:
	void Log(int nLogType, const char* pszFormat, ...);
	bool AddLogger(int nLogType, ILog* pLogger);
	~CLogMgr();
protected:
	CLogMgr();
private:
	stdext::hash_map<int, ILog*> m_hmapLoger;
};


class ILog
{
public:
	ILog(){}
	virtual ~ILog(){}
	virtual void Log(const char* pszLogMsg) = 0;
};

class LogFile : public ILog
{
public:
	LogFile(const char* pszLoggerName);
	virtual ~LogFile();
	virtual void Log(const char* pszLogMsg);
private:
	void ReOpenFile(void);
private:
	std::string m_strLoggerName;
	void* m_pFile;
	time_t tFileTime;
};


LUJ_NAMESPACE_END

#endif //__LOG_H_09320__